$(document).ready(function(e) {
	$(".user_circle").mouseover(function() {
		$(this).find("img").removeClass("c_show");
		$(this).addClass("c_shaw");
	});
	$(".c_note").mouseout(function() {
		$(".img_note").addClass("c_show");
		$(this).removeClass("c_shaw");
	});
	$(".c_plaza").mouseout(function() {
		$(".img_plaza").addClass("c_show");
		$(this).removeClass("c_shaw");
	});
	$(".c_hire").mouseout(function() {
		$(".img_hire").addClass("c_show");
		$(this).removeClass("c_shaw");
	});
	$(".c_news").mouseout(function() {
		$(".img_news").addClass("c_show");
		$(this).removeClass("c_shaw");
	});
	$(".c_addbook").mouseout(function() {
		$(".img_addbook").addClass("c_show");
		$(this).removeClass("c_shaw");
	});
	$(".c_config").mouseout(function() {
		$(".img_config").addClass("c_show");
		$(this).removeClass("c_shaw");
	});

});

$(document).ready(function() {

	$("#close_addbook").click(function() {
		$("#addressbook").fadeOut(500);
		$("#allscreen").fadeOut(500);
	});

	$("#circle_adbook").click(function() {
		$("#allscreen").fadeIn(500);
		$("#addressbook").fadeIn(500);
	});

	$("#circle_config").click(function() {
		$("#allscreen").fadeIn(500);
		$("#user_config").fadeIn(500);
	});

	$("#close_pconfig").click(function() {
		$("#user_config").fadeOut(500);
		$("#allscreen").fadeOut(500);
	});
	$("#config_submit").click(function() {
		$("#user_config").fadeOut(500);
		$("#allscreen").fadeOut(500);
	});

	$("#change_pass").click(function() {
		$(".allscreen_passwordbox").fadeIn(500);
	});
	/* click to confirm change the password */
	$("#pas_submit").click(function() {
		$(".allscreen_passwordbox").fadeOut(500);
	});
	/* click cancle to change the password */
	$("span#pas_cancle").click(function() {
		$(".allscreen_passwordbox").fadeOut(500);
	});
});

function checkpwd0() {
	var pwd = document.password.old_pass.value;
	var regm = /^[\w]{6,20}$/;
	var bp = regm.test(pwd);
	// var pwdlen = pwd.length
	// document.myform.pdiv.value = "密码长度"+pwdlen+"位"
	if (bp == false) {
		document.password.remind.value = "密码是6-20位数字字母";
		document.password.old_pass.style.border = "#C66 solid thin";
		$("#pas_submit").addClass("disabled");
		return false;
	} else {
		document.password.remind.value = "";
		document.password.old_pass.style.border = "#6F9 solid thin";
		$("#pas_submit").removeClass("disabled");
		return true;
	}
}

function checkpwd() {
	var pwd = document.password.new_pass1.value;
	var regm = /^[\w]{6,20}$/;
	var bp = regm.test(pwd);
	// var pwdlen = pwd.length
	// document.myform.pdiv.value = "密码长度"+pwdlen+"位"
	if (bp == false) {
		document.password.remind.value = "密码是6-20位数字字母";
		document.password.new_pass1.style.border = "#C66 solid thin";
		$("#pas_submit").addClass("disabled");
		return false;
	} else {
		document.password.remind.value = "";
		document.password.new_pass1.style.border = "#6F9 solid thin";
		$("#pas_submit").removeClass("disabled");
		return true;
	}
}
function checkpwd2() {
	var pwd = document.password.new_pass1.value;
	var pwd2 = document.password.new_pass2.value;
	if (pwd2 == "") {
		document.password.remind.value = "确认密码框未输入";
		document.password.new_pass2.style.border = "#C66 solid thin";
		return false;
		$("#pas_submit").addClass("disabled");
	} else if (pwd2 != pwd) {
		document.password.new_pass2.style.border = "#C66 solid thin";
		document.password.remind.value = "2次输入密码不相符";
		return false;
		$("#pas_submit").addClass("disabled");
	} else {
		document.password.remind.value = "";
		document.password.new_pass2.style.border = "#6F9 solid thin";
		return true;
		$("#pas_submit").removeClass("disabled");
	}
}
function pascheck() {
	var oldpwd = $("#oldpwd").val();
	var newpwd1 = $("#newpwd1").val();
	var newpwd2 = $("#newpwd2").val();
	$.post("/qiuzhi/UpdatePassword",{
		oldpwd:oldpwd,
		newpwd1:newpwd1,
		newpwd2:newpwd2
	},function(data){
		if(data=="成功"){
			alert("密码修改成功");
		}else{
			alert(data);
		}
	});
}

$(document).ready(function() {
	$("#post_sign").blur(function() {
		var sign = document.user_sign.post_sign.value;
		if (sign.trim() != "") {
			$.post("/qiuzhi/UpdateSignatureController", {
				signature : sign
			}, function(data) {
				if (data == "1") {
					document.user_sign.get_sign.value = sign;
					document.user_sign.post_sign.value="";
				}
			});
		}

	});
});